package one;

import java.util.function.Predicate;

/**
 * Description:
 *
 * @author xzj
 * @date 2021/1/11 23:34
 * @since JDK 1.8
 */
public class Apple {

    private String color;

    private Integer weight;

    public static Predicate<Apple> findGreen = apple -> ("green".equals(apple.getColor()));

    public static Predicate<Apple> findYellow = apple -> "yellow".equals(apple.getColor());

    public static Predicate<Apple> findWeight100 = apple -> apple.getWeight().equals(100);

    public Apple(String color, Integer weight) {

        this.color = color;
        this.weight = weight;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Apple{" +
                "color='" + color + '\'' +
                ", weight=" + weight +
                '}';
    }
}
